﻿function CheckEmail(sender, args) {
    var duplicated = false;
    $.ajax({
        async: false,
        type:'POST',
        url: relRootPath + '/Services/Services.asmx/EmailDuplicated',
        data: "{ 'email': '"+args.Value+"' }",
        dataType: 'json',
        contentType: "application/json",
        success: function(result) {
            duplicated = result.d;
        },
        error: function(result, status) {
            duplicated = true;
        }
    });

    args.IsValid = !duplicated;
}